   * Apply 3 changes based on revisions developed by the fedora linux team.
     + 03-fedora-patch-2.diff
 --> + 04-fedora-tk8.5.6.patch.diff
     + 05-tk8.5-zoomstack.diff
    * Those patches are required to solve segmentation faults that are observed
     when blt is used with tcltk 8.5. We have a substantial amount of
     experience using this patched version of blt in the Swarm
     Simulation System (www.swarm.org) and have observed no ill-effects.
Author: Paul E. Johnson (Debian Packaging) <pauljohn32@freefaculty.org>

--- a/generic/bltTreeViewEdit.c
+++ b/generic/bltTreeViewEdit.c
@@ -1177,9 +1177,15 @@
 	rightPos = count;
 	if ((rightPos < tbPtr->selFirst) || (leftPos > tbPtr->selLast)) {
 	    /* No part of the text fragment is selected. */
+#ifdef TK_DRAWCHARS_ANGLE
+	    Tk_DrawChars(tbPtr->display, drawable, tbPtr->gc, 
+			 tbPtr->font, fragPtr->text, fragPtr->count, 
+			 x + fragPtr->x, y + fragPtr->y, 0.);
+#else
 	    Tk_DrawChars(tbPtr->display, drawable, tbPtr->gc, 
 			 tbPtr->font, fragPtr->text, fragPtr->count, 
 			 x + fragPtr->x, y + fragPtr->y);
+#endif
 	    continue;
 	}
 
@@ -1221,9 +1227,15 @@
 	        width, fontMetrics.linespace,
 		tbPtr->selBorderWidth, tbPtr->selRelief);
 	}
+#ifdef TK_DRAWCHARS_ANGLE
+	Tk_DrawChars(Tk_Display(tbPtr->tkwin), drawable, tbPtr->gc, 
+	     tbPtr->font, fragPtr->text, fragPtr->count, 
+		     fragPtr->x + x, fragPtr->y + y, 0.);
+#else
 	Tk_DrawChars(Tk_Display(tbPtr->tkwin), drawable, tbPtr->gc, 
 	     tbPtr->font, fragPtr->text, fragPtr->count, 
 	     fragPtr->x + x, fragPtr->y + y);
+#endif
     }
     if ((tbPtr->flags & TEXTBOX_FOCUS) && (tbPtr->cursorOn)) {
 	int left, top, right, bottom;
--- a/generic/bltGrPs.c
+++ b/generic/bltGrPs.c
@@ -418,7 +418,7 @@
 	return Tk_ConfigureInfo(interp, graphPtr->tkwin, configSpecs,
 		(char *)psPtr, argv[3], flags);
     }
-    if (Tk_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 3,
+    if (Blt_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 3,
 	    argv + 3, (char *)psPtr, flags) != TCL_OK) {
 	return TCL_ERROR;
     }
@@ -1124,7 +1124,7 @@
 	    fileName = argv[3];	/* First argument is the file name. */
 	    argv++, argc--;
 	}
-	if (Tk_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 3,
+	if (Blt_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 3,
 		argv + 3, (char *)psPtr, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
 	    return TCL_ERROR;
 	}
--- a/generic/bltGrPen.c
+++ b/generic/bltGrPen.c
@@ -215,7 +215,7 @@
     Tcl_FreeProc **freeProcPtr;	/* Not used. */
 {
     Pen *penPtr = *(Pen **)(widgRec + offset);
-
+    if ( ! penPtr ) return NULL;
     return penPtr->name;
 }
 
@@ -510,7 +510,7 @@
 	    return Tk_ConfigureInfo(interp, graphPtr->tkwin, 
 		    penPtr->configSpecs, (char *)penPtr, options[0], flags);
 	}
-	if (Tk_ConfigureWidget(interp, graphPtr->tkwin, penPtr->configSpecs,
+	if (Blt_ConfigureWidget(interp, graphPtr->tkwin, penPtr->configSpecs,
 		nOpts, options, (char *)penPtr, flags) != TCL_OK) {
 	    break;
 	}
--- a/generic/bltGrHairs.c
+++ b/generic/bltGrHairs.c
@@ -390,7 +390,7 @@
 	return Tk_ConfigureInfo(interp, graphPtr->tkwin, configSpecs,
 		(char *)chPtr, argv[3], 0);
     }
-    if (Tk_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 3,
+    if (Blt_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 3,
 	    argv + 3, (char *)chPtr, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
 	return TCL_ERROR;
     }
--- a/generic/bltGraph.c
+++ b/generic/bltGraph.c
@@ -944,7 +944,7 @@
     if (InitPens(graphPtr) != TCL_OK) {
 	goto error;
     }
-    if (Tk_ConfigureWidget(interp, tkwin, configSpecs, argc - 2, argv + 2,
+    if (Blt_ConfigureWidget(interp, tkwin, configSpecs, argc - 2, argv + 2,
 	    (char *)graphPtr, 0) != TCL_OK) {
 	goto error;
     }
@@ -1094,7 +1094,7 @@
 	return Tk_ConfigureInfo(interp, graphPtr->tkwin, configSpecs,
 	    (char *)graphPtr, argv[2], flags);
     } else {
-	if (Tk_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 2,
+	if (Blt_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 2,
 		argv + 2, (char *)graphPtr, flags) != TCL_OK) {
 	    return TCL_ERROR;
 	}
--- a/generic/bltUnixDnd.c
+++ b/generic/bltUnixDnd.c
@@ -1834,7 +1834,7 @@
     unsigned long gcMask;
 
     Tk_MakeWindowExist(tokenPtr->tkwin);
-    if (Tk_ConfigureWidget(interp, tokenPtr->tkwin, tokenConfigSpecs, argc, 
+    if (Blt_ConfigureWidget(interp, tokenPtr->tkwin, tokenConfigSpecs, argc, 
 		argv, (char *)tokenPtr, flags) != TCL_OK) {
 	return TCL_ERROR;
     }
@@ -3777,7 +3777,7 @@
 	return Tk_ConfigureInfo(interp, dndPtr->tkwin, configSpecs,
 	    (char *)dndPtr, argv[3], flags);
     } 
-    if (Tk_ConfigureWidget(interp, dndPtr->tkwin, configSpecs, argc - 3,
+    if (Blt_ConfigureWidget(interp, dndPtr->tkwin, configSpecs, argc - 3,
 		   argv + 3, (char *)dndPtr, flags) != TCL_OK) {
 	return TCL_ERROR;
     }
@@ -4440,7 +4440,7 @@
     dndPtr->hashPtr = hPtr;
     dndPtr->dataPtr = dataPtr;
     Blt_SetHashValue(hPtr, dndPtr);
-    if (Tk_ConfigureWidget(interp, dndPtr->tkwin, configSpecs, argc - 3,
+    if (Blt_ConfigureWidget(interp, dndPtr->tkwin, configSpecs, argc - 3,
 	   argv + 3, (char *)dndPtr, 0) != TCL_OK) {
 	return TCL_ERROR;
     }
--- a/generic/bltCanvEps.c
+++ b/generic/bltCanvEps.c
@@ -1147,7 +1147,7 @@
     int width, height;
 
     tkwin = Tk_CanvasTkwin(canvas);
-    if (Tk_ConfigureWidget(interp, tkwin, configSpecs, argc,
+    if (Blt_ConfigureWidget(interp, tkwin, configSpecs, argc,
 	    argv, (char *)epsPtr, flags) != TCL_OK) {
 	return TCL_ERROR;
     }
@@ -1974,10 +1974,10 @@
 {
     "eps",			/* name */
     sizeof(EpsItem),		/* itemSize */
-    CreateEps,			/* createProc */
+    (Tk_ItemCreateProc *)CreateEps,			/* createProc */
     configSpecs,		/* configSpecs */
-    ConfigureEps,		/* configureProc */
-    EpsCoords,			/* coordProc */
+    (Tk_ItemConfigureProc *)ConfigureEps,		/* configureProc */
+    (Tk_ItemCoordProc *)EpsCoords,			/* coordProc */
     DeleteEps,			/* deleteProc */
     DisplayEps,			/* displayProc */
 #ifdef USE_OLD_CANVAS
@@ -2005,6 +2005,6 @@
 {
     Tk_CreateItemType(&epsItemType);
     /* Initialize custom canvas option routines. */
-    tagsOption.parseProc = Tk_CanvasTagsParseProc;
-    tagsOption.printProc = Tk_CanvasTagsPrintProc;
+    tagsOption.parseProc = (Tk_OptionParseProc *)Tk_CanvasTagsParseProc;
+    tagsOption.printProc = (Tk_OptionPrintProc *)Tk_CanvasTagsPrintProc;
 }
--- a/generic/bltScrollbar.c
+++ b/generic/bltScrollbar.c
@@ -913,7 +913,7 @@
     GC new;
     Tk_Image image;
 
-    if (Tk_ConfigureWidget(interp, scrollPtr->tkwin, configSpecs,
+    if (Blt_ConfigureWidget(interp, scrollPtr->tkwin, configSpecs,
 	    argc, argv, (char *)scrollPtr, flags) != TCL_OK) {
 	return TCL_ERROR;
     }
--- a/generic/bltTreeViewStyle.c
+++ b/generic/bltTreeViewStyle.c
@@ -560,6 +560,11 @@
 }
 
 /*ARGSUSED*/
+
+int
+Blt_TreeViewTextbox(TreeView *tvPtr,
+		    TreeViewEntry *entryPtr,
+		    TreeViewColumn *columnPtr);
 static int
 FreeIcon(clientData, display, widgRec, offset, oldPtr)
     ClientData clientData;
--- a/generic/bltDragdrop.c
+++ b/generic/bltDragdrop.c
@@ -1065,7 +1065,7 @@
     Token *tokenPtr;
 
     tokenPtr = &(srcPtr->token);
-    if (Tk_ConfigureWidget(interp, srcPtr->tkwin, tokenConfigSpecs, argc, argv,
+    if (Blt_ConfigureWidget(interp, srcPtr->tkwin, tokenConfigSpecs, argc, argv,
 	    (char *)tokenPtr, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
 	return TCL_ERROR;
     }
@@ -1293,7 +1293,7 @@
     /*
      *  Handle the bulk of the options...
      */
-    if (Tk_ConfigureWidget(interp, srcPtr->tkwin, configSpecs, argc, argv,
+    if (Blt_ConfigureWidget(interp, srcPtr->tkwin, configSpecs, argc, argv,
 	    (char *)srcPtr, flags) != TCL_OK) {
 	return TCL_ERROR;
     }
--- a/generic/bltAlloc.c
+++ b/generic/bltAlloc.c
@@ -40,14 +40,23 @@
  * Tcl_Alloc/Tcl_Free routines because they don't automatically cause
  * a panic when not enough memory is available. There are cases (such 
  * as allocating a very large vector) where it's recoverable.
+ *
+ * Using private is dangerous.
+ * Tcl changes mem functions for debug which will conflict then with BLT
+ * stick to public API
  */
-EXTERN Blt_MallocProc TclpAlloc;
-EXTERN Blt_FreeProc TclpFree;
-EXTERN Blt_ReallocProc TclpRealloc;
+//EXTERN Blt_MallocProc TclpAlloc;
+//EXTERN Blt_FreeProc TclpFree;
+//EXTERN Blt_ReallocProc TclpRealloc;
+
+//Blt_MallocProc *Blt_MallocProcPtr = TclpAlloc;
+//Blt_FreeProc *Blt_FreeProcPtr = TclpFree; 
+//Blt_ReallocProc *Blt_ReallocProcPtr = TclpRealloc;
+
+Blt_MallocProc *Blt_MallocProcPtr = (Blt_MallocProc *)Tcl_Alloc;
+Blt_FreeProc *Blt_FreeProcPtr = (Blt_FreeProc *)Tcl_Free; 
+Blt_ReallocProc *Blt_ReallocProcPtr = (Blt_ReallocProc *)Tcl_Realloc; 
 
-Blt_MallocProc *Blt_MallocProcPtr = TclpAlloc;
-Blt_FreeProc *Blt_FreeProcPtr = TclpFree; 
-Blt_ReallocProc *Blt_ReallocProcPtr = TclpRealloc; 
 #else
 
 Blt_MallocProc *Blt_MallocProcPtr = malloc;
--- a/generic/bltGrLegd.c
+++ b/generic/bltGrLegd.c
@@ -1406,7 +1406,7 @@
 	return Tk_ConfigureInfo(interp, graphPtr->tkwin, configSpecs,
 		(char *)legendPtr, argv[3], flags);
     }
-    if (Tk_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 3,
+    if (Blt_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 3,
 	    argv + 3, (char *)legendPtr, flags) != TCL_OK) {
 	return TCL_ERROR;
     }
--- a/generic/bltHierbox.c
+++ b/generic/bltHierbox.c
@@ -3321,7 +3321,7 @@
     XColor *colorPtr;
 
     hierBox = hboxPtr;
-    if (Tk_ConfigureWidget(hboxPtr->interp, hboxPtr->tkwin, entryConfigSpecs,
+    if (Blt_ConfigureWidget(hboxPtr->interp, hboxPtr->tkwin, entryConfigSpecs,
 	    argc, argv, (char *)entryPtr, flags) != TCL_OK) {
 	return TCL_ERROR;
     }
@@ -3935,7 +3935,7 @@
     Tk_Uid nameId;
     Pixmap bitmap;
     hierBox = hboxPtr;
-    if (Tk_ConfigureWidget(interp, hboxPtr->tkwin, configSpecs, argc, argv,
+    if (Blt_ConfigureWidget(interp, hboxPtr->tkwin, configSpecs, argc, argv,
 	    (char *)hboxPtr, flags) != TCL_OK) {
 	return TCL_ERROR;
     }
@@ -4443,7 +4443,7 @@
     Drawable drawable;		/* Pixmap or window to draw into. */
 {
     Entry *entryPtr;		/* Entry to be drawn. */
-    int x1, y1, x2, y2;
+    int x1, y1i, x2, y2;
     int height;
     int x, y;
 
@@ -4463,22 +4463,22 @@
 	y += (height - hboxPtr->button.height) / 2;
 	x1 = x2 = x + LEVELWIDTH(treePtr->level) +
 	    LEVELWIDTH(treePtr->level + 1) / 2;
-	y1 = y + hboxPtr->button.height / 2;
-	y2 = y1 + entryPtr->lineHeight;
+	y1i = y + hboxPtr->button.height / 2;
+	y2 = y1i + entryPtr->lineHeight;
 	if ((treePtr == hboxPtr->rootPtr) && (hboxPtr->hideRoot)) {
-	    y1 += entryPtr->height;
+	    y1i += entryPtr->height;
 	}
 	/*
 	 * Clip the line's Y-coordinates at the window border.
 	 */
-	if (y1 < 0) {
-	    y1 = 0;
+	if (y1i < 0) {
+	    y1i = 0;
 	}
 	if (y2 > Tk_Height(hboxPtr->tkwin)) {
 	    y2 = Tk_Height(hboxPtr->tkwin);
 	}
-	if ((y1 < Tk_Height(hboxPtr->tkwin)) && (y2 > 0)) {
-	    XDrawLine(hboxPtr->display, drawable, hboxPtr->lineGC, x1, y1, 
+	if ((y1i < Tk_Height(hboxPtr->tkwin)) && (y2 > 0)) {
+	    XDrawLine(hboxPtr->display, drawable, hboxPtr->lineGC, x1, y1i, 
 		      x2, y2);
 	}
     }
@@ -4788,17 +4788,17 @@
 	    x, y);
     }
     if ((isFocused) && (hboxPtr->focusEdit) && (editPtr->cursorOn)) {
-	int x1, y1, x2, y2;
+	int x1, y1i, x2, y2;
 
 	GetCursorLocation(hboxPtr, treePtr);
 	x1 = x + editPtr->x;
 	x2 = x1 + 3;
-	y1 = y + editPtr->y - 1;
-	y2 = y1 + editPtr->height - 1;
+	y1i = y + editPtr->y - 1;
+	y2 = y1i + editPtr->height - 1;
 	XDrawLine(hboxPtr->display, drawable, entryPtr->labelGC,
-	    x1, y1, x1, y2);
+	    x1, y1i, x1, y2);
 	XDrawLine(hboxPtr->display, drawable, entryPtr->labelGC,
-	    x1 - 2, y1, x2, y1);
+	    x1 - 2, y1i, x2, y1i);
 	XDrawLine(hboxPtr->display, drawable, entryPtr->labelGC,
 	    x1 - 2, y2, x2, y2);
     }
@@ -4859,7 +4859,7 @@
     int width, height;
     int entryHeight;
     int buttonY;
-    int x1, y1, x2, y2;
+    int x1, y1i, x2, y2;
     Entry *entryPtr;
 
     entryPtr = treePtr->entryPtr;
@@ -4875,7 +4875,7 @@
     buttonY = y + entryPtr->buttonY;
 
     x1 = x + (width / 2);
-    y1 = y2 = buttonY + (buttonPtr->height / 2);
+    y1i = y2 = buttonY + (buttonPtr->height / 2);
     x2 = x1 + (LEVELWIDTH(treePtr->level) + LEVELWIDTH(treePtr->level + 1)) / 2;
 
     if ((treePtr->parentPtr != NULL) && (hboxPtr->lineWidth > 0)) {
@@ -4883,17 +4883,17 @@
 	 * For every node except root, draw a horizontal line from
 	 * the vertical bar to the middle of the icon.
 	 */
-	XDrawLine(hboxPtr->display, drawable, hboxPtr->lineGC, x1, y1, x2, y2);
+	XDrawLine(hboxPtr->display, drawable, hboxPtr->lineGC, x1, y1i, x2, y2);
     }
     if ((entryPtr->flags & ENTRY_OPEN) && (hboxPtr->lineWidth > 0)) {
 	/*
 	 * Entry is open, draw vertical line.
 	 */
-	y2 = y1 + entryPtr->lineHeight;
+	y2 = y1i + entryPtr->lineHeight;
 	if (y2 > Tk_Height(hboxPtr->tkwin)) {
 	    y2 = Tk_Height(hboxPtr->tkwin);	/* Clip line at window border. */
 	}
-	XDrawLine(hboxPtr->display, drawable, hboxPtr->lineGC, x2, y1, x2, y2);
+	XDrawLine(hboxPtr->display, drawable, hboxPtr->lineGC, x2, y1i, x2, y2);
     }
     if ((entryPtr->flags & ENTRY_BUTTON) && (treePtr->parentPtr != NULL)) {
 	/*
@@ -5506,7 +5506,7 @@
 	return Tk_ConfigureInfo(interp, hboxPtr->tkwin, buttonConfigSpecs,
 	    (char *)hboxPtr, argv[0], 0);
     }
-    if (Tk_ConfigureWidget(hboxPtr->interp, hboxPtr->tkwin, buttonConfigSpecs,
+    if (Blt_ConfigureWidget(hboxPtr->interp, hboxPtr->tkwin, buttonConfigSpecs,
 	    argc, argv, (char *)hboxPtr, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
 	return TCL_ERROR;
     }
--- a/generic/bltBusy.c
+++ b/generic/bltBusy.c
@@ -418,7 +418,7 @@
     Tk_Cursor oldCursor;
 
     oldCursor = busyPtr->cursor;
-    if (Tk_ConfigureWidget(interp, busyPtr->tkRef, configSpecs, argc, argv,
+    if (Blt_ConfigureWidget(interp, busyPtr->tkRef, configSpecs, argc, argv,
 	    (char *)busyPtr, 0) != TCL_OK) {
 	return TCL_ERROR;
     }
--- a/generic/bltConfig.c
+++ b/generic/bltConfig.c
@@ -1573,7 +1573,7 @@
     Blt_Free(tempName);
 
     Tk_SetClass(tkwin, className);
-    result = Tk_ConfigureWidget(interp, tkwin, specsPtr, argc, argv, widgRec,
+    result = Blt_ConfigureWidget(interp, tkwin, specsPtr, argc, argv, widgRec,
 	flags);
     if (isTemporary) {
 	Tk_DestroyWindow(tkwin);
--- a/generic/bltTed.c
+++ b/generic/bltTed.c
@@ -826,7 +826,7 @@
     GC newGC;
     unsigned long gcMask;
 
-    if (Tk_ConfigureWidget(tedPtr->interp, tedPtr->tkwin, configSpecs,
+    if (Blt_ConfigureWidget(tedPtr->interp, tedPtr->tkwin, configSpecs,
 	    argc, argv, (char *)tedPtr, flags) != TCL_OK) {
 	return TCL_ERROR;
     }
--- a/generic/bltGrAxis.c
+++ b/generic/bltGrAxis.c
@@ -3448,7 +3448,7 @@
 	return Tk_ConfigureInfo(graphPtr->interp, graphPtr->tkwin, configSpecs,
 	    (char *)axisPtr, argv[0], flags);
     }
-    if (Tk_ConfigureWidget(graphPtr->interp, graphPtr->tkwin, configSpecs,
+    if (Blt_ConfigureWidget(graphPtr->interp, graphPtr->tkwin, configSpecs,
 	    argc, argv, (char *)axisPtr, flags) != TCL_OK) {
 	return TCL_ERROR;
     }
--- a/generic/bltHtext.c
+++ b/generic/bltHtext.c
@@ -40,6 +40,13 @@
  *    of the virtual text.
  */
 
+/*
+ * the htext widget is broken in tk8.5.6 as
+ * Tk_ConfigureWidget no longer supports
+ * queries of changed options. Need to migrate to Tk_SetOptions
+ * instead hack a wrapper Blt_ConfigureWidget
+ */
+
 #include "bltInt.h"
 
 #ifndef NO_HTEXT
@@ -338,7 +345,7 @@
 	TK_CONFIG_DONT_SET_DEFAULT, &heightOption},
     {TK_CONFIG_CUSTOM, "-linespacing", "lineSpacing", "LineSpacing",
 	DEF_HTEXT_LINE_SPACING, Tk_Offset(HText, leader),
-	TK_CONFIG_DONT_SET_DEFAULT, &bltDistanceOption},
+ 	TK_CONFIG_DONT_SET_DEFAULT, &bltDistanceOption},
     {TK_CONFIG_CUSTOM, "-maxheight", "maxHeight", "MaxHeight",
 	DEF_HTEXT_MAX_HEIGHT, Tk_Offset(HText, maxHeight),
 	TK_CONFIG_DONT_SET_DEFAULT, &bltDistanceOption},
@@ -2841,9 +2848,15 @@
     Tk_GetFontMetrics(htPtr->font, &fontMetrics);
     if ((segPtr->textEnd < htPtr->selFirst) ||
 	(segPtr->textStart > htPtr->selLast)) {	/* No selected text */
+#ifdef TK_DRAWCHARS_ANLGE
+	Tk_DrawChars(htPtr->display, draw, htPtr->drawGC, htPtr->font,
+	    htPtr->charArr + segPtr->textStart, textLength - 1,
+		     x, y + linePtr->baseline, 0.);
+#else
 	Tk_DrawChars(htPtr->display, draw, htPtr->drawGC, htPtr->font,
 	    htPtr->charArr + segPtr->textStart, textLength - 1,
 	    x, y + linePtr->baseline);
+#endif
 	return;
     }
     /*
@@ -2872,9 +2885,15 @@
 	Tk_MeasureChars(htPtr->font, htPtr->charArr + segPtr->textStart,
 	    nChars, 10000, DEF_TEXT_FLAGS, &lastX);
 	lastX += x;
+#ifdef TK_DRAWCHARS_ANGLE
+	Tk_DrawChars(htPtr->display, draw, htPtr->drawGC, htPtr->font,
+	    htPtr->charArr + segPtr->textStart, nChars, x,
+		     y + linePtr->baseline, 0.);
+#else
 	Tk_DrawChars(htPtr->display, draw, htPtr->drawGC, htPtr->font,
 	    htPtr->charArr + segPtr->textStart, nChars, x,
 	    y + linePtr->baseline);
+#endif
 	curPos = selStart;
     }
     if (selLength > 0) {	/* The selection itself */
@@ -2890,16 +2909,28 @@
 	    lastX, y + linePtr->baseline - fontMetrics.ascent,
 	    width, fontMetrics.linespace, htPtr->selBorderWidth,
 	    TK_RELIEF_RAISED);
+#ifdef TK_DRAWCHARS_ANGLE
+	Tk_DrawChars(htPtr->display, draw, htPtr->selectGC,
+	    htPtr->font, htPtr->charArr + selStart, selLength,
+		     lastX, y + linePtr->baseline, 0.);
+#else
 	Tk_DrawChars(htPtr->display, draw, htPtr->selectGC,
 	    htPtr->font, htPtr->charArr + selStart, selLength,
 	    lastX, y + linePtr->baseline);
+#endif
 	lastX = nextX;
 	curPos = selStart + selLength;
     }
     nChars = segPtr->textEnd - curPos;
     if (nChars > 0) {		/* Text following the selection */
+#ifdef TK_DRAWCHARS_ANGLE
+	Tk_DrawChars(htPtr->display, draw, htPtr->drawGC, htPtr->font,
+		     htPtr->charArr + curPos, nChars - 1,
+		     lastX, y + linePtr->baseline, 0.);
+#else
 	Tk_DrawChars(htPtr->display, draw, htPtr->drawGC, htPtr->font,
 	    htPtr->charArr + curPos, nChars - 1, lastX, y + linePtr->baseline);
+#endif
     }
 }
 
@@ -3055,18 +3086,21 @@
 	XFillRectangle(display, pixmap, htPtr->fillGC, 0, 0, width, height);
     }
 
-
-    if (! htPtr->lineArr) return;
-    if (deltaY >= 0) {
+    /* handle null lineArr */
+    if (htPtr->arraySize > 0 && htPtr->nLines > 0) {
+      if (deltaY >= 0) {
 	y += htPtr->lineArr[htPtr->first].offset;
 	lineNum = htPtr->first;
 	lastY = 0;
-    } else {
+      } else {
 	y += htPtr->lineArr[htPtr->last].offset;
 	lineNum = htPtr->last;
 	lastY = height;
+      }
+      forceCopy = 0;
+    } else {
+      htPtr->last = htPtr->first - 1;
     }
-    forceCopy = 0;
 
     /* Draw each line */
     for (i = htPtr->first; i <= htPtr->last; i++) {
@@ -3365,7 +3399,8 @@
      * The page is always draw at full width and the viewport will clip
      * the text.
      */
-    if ((htPtr->first != oldFirst) || (htPtr->last != oldLast)) {
+    if ((htPtr->first != oldFirst) || (htPtr->last != oldLast)
+	|| htPtr->flags & TEXT_DIRTY ) {
 	int offset;
 	int i;
 	int first, last;
@@ -3383,23 +3418,26 @@
 	}
         if (! htPtr->lineArr) return;
 
-	for (i = first; i <= last; i++) {
+
+	if (htPtr->arraySize > 0 && htPtr->nLines > 0) {
+	  for (i = first; i <= last; i++) {
 	    offset = htPtr->lineArr[i].offset;
 	    for (linkPtr = Blt_ChainFirstLink(htPtr->lineArr[i].chainPtr);
-		linkPtr != NULL; linkPtr = Blt_ChainNextLink(linkPtr)) {
-		winPtr = Blt_ChainGetValue(linkPtr);
-		if (winPtr->tkwin != NULL) {
-		    MoveEmbeddedWidget(winPtr, offset);
-		    winPtr->flags &= ~WIDGET_VISIBLE;
-		}
+		 linkPtr != NULL; linkPtr = Blt_ChainNextLink(linkPtr)) {
+	      winPtr = Blt_ChainGetValue(linkPtr);
+	      if (winPtr->tkwin != NULL) {
+		MoveEmbeddedWidget(winPtr, offset);
+		winPtr->flags &= ~WIDGET_VISIBLE;
+	      }
 	    }
+	  }
 	}
-    }
-    DrawPage(htPtr, deltaY);
-    SendBogusEvent(tkwin);
+	DrawPage(htPtr, deltaY);
+	SendBogusEvent(tkwin);
 
-    /* Reset flags */
-    htPtr->flags &= ~TEXT_DIRTY;
+	/* Reset flags */
+	htPtr->flags &= ~TEXT_DIRTY;
+    }
 }
 
 /* Selection Procedures */
@@ -3919,7 +3957,7 @@
     if (winPtr == NULL) {
 	return TCL_ERROR;
     }
-    if (Tk_ConfigureWidget(interp, htPtr->tkwin, widgetConfigSpecs,
+    if (Blt_ConfigureWidget(interp, htPtr->tkwin, widgetConfigSpecs,
 	    argc - 3, argv + 3, (char *)winPtr, 0) != TCL_OK) {
 	return TCL_ERROR;
     }
@@ -4089,8 +4127,13 @@
 	return Tk_ConfigureInfo(interp, htPtr->tkwin, specsPtr, itemPtr,
 		argv[2], 0);
     }
-    if (Tk_ConfigureWidget(interp, htPtr->tkwin, specsPtr, argc - 2,
-	    argv + 2, itemPtr, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
+    if (Blt_ConfigureWidget(interp, htPtr->tkwin, specsPtr, argc - 2,
+    	    argv + 2, itemPtr, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
+
+      /*
+       * in 8.5 cant tell if in option was modified
+       * supposed to convert to Tk_SetOptions
+       */
 	return TCL_ERROR;
     }
     if (itemPtr == (char *)htPtr) {
@@ -4487,7 +4530,7 @@
 #ifdef ITCL_NAMESPACES
     Itk_SetWidgetCommand(htPtr->tkwin, htPtr->cmdToken);
 #endif
-    if ((Tk_ConfigureWidget(interp, htPtr->tkwin, configSpecs, argc - 2,
+    if ((Blt_ConfigureWidget(interp, htPtr->tkwin, configSpecs, argc - 2,
 		argv + 2, (char *)htPtr, 0) != TCL_OK) ||
 	(ConfigureText(interp, htPtr) != TCL_OK)) {
 	Tk_DestroyWindow(htPtr->tkwin);
--- a/generic/bltWinDraw.c
+++ b/generic/bltWinDraw.c
@@ -1647,8 +1647,13 @@
     if (drawable == None) {
 	return;
     }
+#ifdef TK_DRAWCHARS_ANGLE
+    Tk_DrawChars(display, drawable, gc, (Tk_Font)gc->font, string, length, 
+		 x, y, 0.);
+#else
     Tk_DrawChars(display, drawable, gc, (Tk_Font)gc->font, string, length, 
 	x, y);
+#endif
 }
 
 static void
--- a/generic/bltGrMarker.c
+++ b/generic/bltGrMarker.c
@@ -4313,7 +4313,7 @@
 	/* Save the old marker. */
 	oldName = markerPtr->name;
 	under = markerPtr->drawUnder;
-	if (Tk_ConfigureWidget(interp, graphPtr->tkwin, 
+	if (Blt_ConfigureWidget(interp, graphPtr->tkwin, 
 		markerPtr->classPtr->configSpecs, nOpts, options, 
 		(char *)markerPtr, flags) != TCL_OK) {
 	    return TCL_ERROR;
--- a/generic/bltBitmap.c
+++ b/generic/bltBitmap.c
@@ -917,7 +917,7 @@
     info.padLeft = info.padRight = 0;
     info.padTop = info.padBottom = 0;
     info.font = (Tk_Font)NULL;	/* Initialized by Tk_ConfigureWidget */
-    if (Tk_ConfigureWidget(interp, tkwin, composeConfigSpecs,
+    if (Blt_ConfigureWidget(interp, tkwin, composeConfigSpecs,
 	    argc - 4, argv + 4, (char *)&info, 0) != TCL_OK) {
 	return TCL_ERROR;
     }
@@ -1027,7 +1027,7 @@
     /* Initialize info and then process flags */
     info.rotate = 0.0;		/* No rotation by default */
     info.scale = 1.0;		/* No scaling by default */
-    if (Tk_ConfigureWidget(interp, dataPtr->tkwin, defineConfigSpecs,
+    if (Blt_ConfigureWidget(interp, dataPtr->tkwin, defineConfigSpecs,
 	    argc - 4, argv + 4, (char *)&info, 0) != TCL_OK) {
 	return TCL_ERROR;
     }
--- a/generic/bltTabnotebook.c
+++ b/generic/bltTabnotebook.c
@@ -2766,7 +2766,7 @@
     GC newGC;
 
     lastNotebookInstance = nbPtr;
-    if (Tk_ConfigureWidget(interp, nbPtr->tkwin, configSpecs, argc, argv,
+    if (Blt_ConfigureWidget(interp, nbPtr->tkwin, configSpecs, argc, argv,
 	    (char *)nbPtr, flags) != TCL_OK) {
 	return TCL_ERROR;
     }
@@ -3691,7 +3691,7 @@
 	}
 	Tcl_Preserve(tabPtr);
 	lastNotebookInstance = nbPtr;
-	result = Tk_ConfigureWidget(interp, nbPtr->tkwin, tabConfigSpecs,
+	result = Blt_ConfigureWidget(interp, nbPtr->tkwin, tabConfigSpecs,
 	    nOpts, options, (char *)tabPtr, TK_CONFIG_ARGV_ONLY);
 	if (result == TCL_OK) {
 	    result = ConfigureTab(nbPtr, tabPtr);
--- a/generic/bltContainer.c
+++ b/generic/bltContainer.c
@@ -1193,7 +1193,7 @@
     GC newGC;
     int width, height;
 
-    if (Tk_ConfigureWidget(interp, cntrPtr->tkwin, configSpecs, argc, argv,
+    if (Blt_ConfigureWidget(interp, cntrPtr->tkwin, configSpecs, argc, argv,
 	    (char *)cntrPtr, flags) != TCL_OK) {
 	return TCL_ERROR;
     }
--- a/generic/bltTabset.c
+++ b/generic/bltTabset.c
@@ -3163,7 +3163,7 @@
     XColor *activeColor;	/* Active foreground. */
 
     tabSet = setPtr;
-    if (Tk_ConfigureWidget(interp, setPtr->tkwin, configSpecs, argc, argv,
+    if (Blt_ConfigureWidget(interp, setPtr->tkwin, configSpecs, argc, argv,
 	    (char *)setPtr, flags) != TCL_OK) {
 	return TCL_ERROR;
     }
@@ -4452,7 +4452,7 @@
 	}
 	tabSet = setPtr;
 	Tcl_Preserve(tabPtr);
-	result = Tk_ConfigureWidget(interp, setPtr->tkwin, tabConfigSpecs,
+	result = Blt_ConfigureWidget(interp, setPtr->tkwin, tabConfigSpecs,
 	    nOpts, options, (char *)tabPtr, TK_CONFIG_ARGV_ONLY);
 	if (result == TCL_OK || nOpts>=2) {
 	    result = ConfigureTab(setPtr, tabPtr);
--- a/generic/bltGrGrid.c
+++ b/generic/bltGrGrid.c
@@ -368,7 +368,7 @@
 	return Tk_ConfigureInfo(interp, graphPtr->tkwin, configSpecs,
 	    (char *)gridPtr, argv[3], flags);
     }
-    if (Tk_ConfigureWidget(graphPtr->interp, graphPtr->tkwin, configSpecs,
+    if (Blt_ConfigureWidget(graphPtr->interp, graphPtr->tkwin, configSpecs,
 	    argc - 3, argv + 3, (char *)gridPtr, flags) != TCL_OK) {
 	return TCL_ERROR;
     }
--- a/generic/tkButton.c
+++ b/generic/tkButton.c
@@ -1721,7 +1721,7 @@
         oldSelVar = (butPtr->selVarName?strdup(butPtr->selVarName):NULL);
     }
     
-    if (Tk_ConfigureWidget(interp, butPtr->tkwin, configSpecs,
+    if (Blt_ConfigureWidget(interp, butPtr->tkwin, configSpecs,
 	    argc, argv, (char *)butPtr, flags) != TCL_OK) {
         if (oldTextVar) ckfree(oldTextVar);
         if (oldTextVar) ckfree(oldSelVar);
--- a/generic/bltGrElem.c
+++ b/generic/bltGrElem.c
@@ -1699,7 +1699,7 @@
     search.x = x;
     search.y = y;
 
-    if (Tk_ConfigureWidget(interp, graphPtr->tkwin, closestSpecs, i - 6,
+    if (Blt_ConfigureWidget(interp, graphPtr->tkwin, closestSpecs, i - 6,
 	    argv + 6, (char *)&search, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
 	return TCL_ERROR;	/* Error occurred processing an option. */
     }
@@ -1854,7 +1854,7 @@
 	    return Tk_ConfigureInfo(interp, graphPtr->tkwin, 
 		elemPtr->specsPtr, (char *)elemPtr, options[0], flags);
 	}
-	if (Tk_ConfigureWidget(interp, graphPtr->tkwin, elemPtr->specsPtr, 
+	if (Blt_ConfigureWidget(interp, graphPtr->tkwin, elemPtr->specsPtr, 
 		numOpts, options, (char *)elemPtr, flags) != TCL_OK) {
 	    return TCL_ERROR;
 	}
--- a/generic/bltTable.c
+++ b/generic/bltTable.c
@@ -1201,7 +1201,7 @@
     oldRowSpan = entryPtr->row.span;
     oldColSpan = entryPtr->column.span;
 
-    if (Tk_ConfigureWidget(interp, entryPtr->tkwin, entryConfigSpecs,
+    if (Blt_ConfigureWidget(interp, entryPtr->tkwin, entryConfigSpecs,
 	    argc, argv, (char *)entryPtr, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
 	return TCL_ERROR;
     }
@@ -1553,7 +1553,7 @@
 		return Tk_ConfigureInfo(tablePtr->interp, tablePtr->tkwin,
 		    infoPtr->configSpecs, (char *)rcPtr, argv[0], 0);
 	    } else {
-		if (Tk_ConfigureWidget(tablePtr->interp, tablePtr->tkwin,
+		if (Blt_ConfigureWidget(tablePtr->interp, tablePtr->tkwin,
 			infoPtr->configSpecs, argc, argv, (char *)rcPtr,
 			TK_CONFIG_ARGV_ONLY) != TCL_OK) {
 		    return TCL_ERROR;
@@ -1578,7 +1578,7 @@
 	}
 	rcPtr = GetRowColumn(infoPtr, n);
 	assert(rcPtr);
-	if (Tk_ConfigureWidget(tablePtr->interp, tablePtr->tkwin,
+	if (Blt_ConfigureWidget(tablePtr->interp, tablePtr->tkwin,
 	       infoPtr->configSpecs, argc, argv, (char *)rcPtr,
 	       TK_CONFIG_ARGV_ONLY) != TCL_OK) {
 	    return TCL_ERROR;
@@ -1861,7 +1861,7 @@
 	return Tk_ConfigureInfo(interp, tablePtr->tkwin, tableConfigSpecs,
 	    (char *)tablePtr, argv[0], 0);
     }
-    if (Tk_ConfigureWidget(interp, tablePtr->tkwin, tableConfigSpecs,
+    if (Blt_ConfigureWidget(interp, tablePtr->tkwin, tableConfigSpecs,
 	    argc, argv, (char *)tablePtr, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
 	return TCL_ERROR;
     }
@@ -2198,7 +2198,7 @@
 	}
     }
     if (argc > 0) {
-	result = Tk_ConfigureWidget(tablePtr->interp, entryPtr->tkwin,
+	result = Blt_ConfigureWidget(tablePtr->interp, entryPtr->tkwin,
 	    entryConfigSpecs, argc, argv, (char *)entryPtr,
 	    TK_CONFIG_ARGV_ONLY);
     }
